Package com.jeovanimartinez.androidutils.extensions.dimension

Functions

Link copied to clipboard
fun Context.dimen(@DimenRes resource: Int): Int
fun View.dimen(@DimenRes resource: Int): Int

Retrieve a dimensional for a particular resource ID for use as a size in raw pixels. Return the result as Int

Link copied to clipboard
fun Context.dimenF(@DimenRes resource: Int): Float
fun View.dimenF(@DimenRes resource: Int): Float

Retrieve a dimensional for a particular resource ID for use as a size in raw pixels. Return the result as Float

Link copied to clipboard
fun Context.dp2px(value: Float): Int
fun Context.dp2px(value: Int): Int
fun View.dp2px(value: Float): Int
fun View.dp2px(value: Int): Int

Converts dp to px. Return the result as Int

Link copied to clipboard
fun Context.dp2pxF(value: Float): Float
fun Context.dp2pxF(value: Int): Float
fun View.dp2pxF(value: Float): Float
fun View.dp2pxF(value: Int): Float

Converts dp to px. Return the result as Float

Link copied to clipboard
fun Context.px2dp(value: Float): Int
fun Context.px2dp(value: Int): Int
fun View.px2dp(value: Float): Int
fun View.px2dp(value: Int): Int

Converts px to dp. Return the result as Int

Link copied to clipboard
fun Context.px2dpF(value: Float): Float
fun Context.px2dpF(value: Int): Float
fun View.px2dpF(value: Float): Float
fun View.px2dpF(value: Int): Float

Converts px to dp. Return the result as Float

Link copied to clipboard
fun Context.px2sp(value: Float): Int
fun Context.px2sp(value: Int): Int
fun View.px2sp(value: Float): Int
fun View.px2sp(value: Int): Int

Converts px to sp. Return the result as Int

Link copied to clipboard
fun Context.px2spF(value: Float): Float
fun Context.px2spF(value: Int): Float
fun View.px2spF(value: Float): Float
fun View.px2spF(value: Int): Float

Converts px to sp. Return the result as Float

Link copied to clipboard
fun Context.sp2px(value: Float): Int
fun Context.sp2px(value: Int): Int
fun View.sp2px(value: Float): Int
fun View.sp2px(value: Int): Int

Converts sp to px. Return the result as Int

Link copied to clipboard
fun Context.sp2pxF(value: Float): Float
fun Context.sp2pxF(value: Int): Float
fun View.sp2pxF(value: Float): Float
fun View.sp2pxF(value: Int): Float

Converts sp to px. Return the result as Float